/*
 * Copyright (c) 2025 Li Auto Inc. and its affiliates
 * Licensed under the Apache License, Version 2.0(the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "Platform_Types.h"

#if !defined(ETHTRCV_GENERAL_TYPES_H)
#define ETHTRCV_GENERAL_TYPES_H

/**********************************************************************************************************************
 *  GLOBAL CONSTANT MACROS
 *********************************************************************************************************************/
/* ETHTRCV modes */
#define ETHTRCV_MODE_DOWN (0x00U)
#define ETHTRCV_MODE_ACTIVE (0x01U)

/* ETHTRCV link states */
#define ETHTRCV_LINK_STATE_DOWN (0x00U)
#define ETHTRCV_LINK_STATE_ACTIVE (0x01U)

/* ETHTRCV baud rates */
#define ETHTRCV_BAUD_RATE_10MBIT (0x00U)
#define ETHTRCV_BAUD_RATE_100MBIT (0x01U)
#define ETHTRCV_BAUD_RATE_1000MBIT (0x02U)

/* ETHTRCV duplex modes */
#define ETHTRCV_DUPLEX_MODE_HALF (0x00U)
#define ETHTRCV_DUPLEX_MODE_FULL (0x01U)

/* ETHTRCV state */
#define ETHTRCV_STATE_UNINIT (0x00U)
#define ETHTRCV_STATE_INIT (0x01U)
#define ETHTRCV_STATE_ACTIVE (0x02U)
#define ETHTRCV_STATE_DOWN (0x03U)

/* ETHTRCV wakeup types */
#define ETHTRCV_WAKEUP_NOT_SUPPORTED (0x00U)
#define ETHTRCV_WAKEUP_BY_INTERRUPT (0x01U)
#define ETHTRCV_WAKEUP_BY_POLLING (0x02U)

/* ETHTRCV wakeup modes */
#define ETHTRCV_WUM_DISABLE (0x00U)
#define ETHTRCV_WUM_ENABLE (0x01U)
#define ETHTRCV_WUM_CLEAR (0x02U)

/* ETHTRCV wakeup reasons */
#define ETHTRCV_WUR_NONE (0x00U)
#define ETHTRCV_WUR_GENERAL (0x01U)
#define ETHTRCV_WUR_BUS (0x02U)
#define ETHTRCV_WUR_INTERNAL (0x03U)
#define ETHTRCV_WUR_RESET (0x04U)
#define ETHTRCV_WUR_POWER_ON (0x05U)
#define ETHTRCV_WUR_PIN (0x06U)
#define ETHTRCV_WUR_SYSERR (0x07U)
/* count of AUTOSAR wakeup reasons defined for the transceiver */
#define ETHTRCV_WUR_NUM (0x07U)

/* Masks defining the bitpositions of the AUTOSAR wakeup reasons for type EthTrcv_WakeupReasonFlagsType. */
#define ETHTRCV_WUR_GENERAL_FLAGS_MASK (0x01U)
#define ETHTRCV_WUR_BUS_FLAGS_MASK (0x02U)
#define ETHTRCV_WUR_INTERNAL_FLAGS_MASK (0x04U)
#define ETHTRCV_WUR_RESET_FLAGS_MASK (0x08U)
#define ETHTRCV_WUR_POWER_ON_FLAGS_MASK (0x10U)
#define ETHTRCV_WUR_PIN_FLAGS_MASK (0x20U)
#define ETHTRCV_WUR_SYSERR_FLAGS_MASK (0x40U)
#define ETHTRCV_WUR_CLEAR_MASK (0x00U)

/* EthTrcv wakeup inspection types */
#define ETHTRCV_ICU_CHANNEL (0x01U)
#define ETHTRCV_TRCV_REGISTERS (0x02U)
#define ETHTRCV_USER_CODE (0x03U)

/* ETHTRCV MII modes */
#define ETHTRCV_MII_MODE (0x00U)
#define ETHTRCV_LIGHT_MII_MODE (0x01U)
#define ETHTRCV_RMII_MODE (0x02U)
#define ETHTRCV_RMII_XTAL_MODE (0x03U)
#define ETHTRCV_GMII_MODE (0x04U)
#define ETHTRCV_RGMII_MODE (0x05U)
#define ETHTRCV_RGMII_XTAL_MODE (0x06U)
#define ETHTRCV_STRAPPING_CONFIG_ONLY (0x07U)
#define ETHTRCV_DONT_CARE (0xFFU)

/* ETHTRCV CONN NEG modes*/
#define ETHTRCV_CONN_NEG_AUTO (0x00U)
#define ETHTRCV_CONN_NEG_MASTER (0x01U)
#define ETHTRCV_CONN_NEG_SLAVE (0x02U)
#define ETHTRCV_CONN_NEG_MANUAL (0x03U)

#define ETHTRCV_PHYS_ADDR_LEN_BYTE (0x06U)

typedef uint8 eth_trcv_linkstate_type;
typedef uint8 EthTrcv_WakeupReasonFlagsType;
typedef uint8 EthTrcv_WakeupInspectionType;
typedef uint8 EthTrcv_PhysAddrType[ETHTRCV_PHYS_ADDR_LEN_BYTE];
typedef uint16 eth_frame_type;

typedef uint16 eth_frame_type;
typedef uint8 eth_data_type;
typedef uint32 eth_buf_idx_type;

#endif /* ETHTRCV_GENERAL_TYPES_H */
